<template>
	<a-descriptions size="small">
		<template #title>
			<div class="d-module-title">
				<b>预定信息</b>
			</div>
		</template>
		<a-descriptions-item label="状态" :span="3">
			<a-tag :color="dataSource.statusInfo.color">{{ dataSource.statusInfo.name }}</a-tag>
			<a-statistic-countdown v-if="dataSource.bookStatus === 1" :value="Date.now() + dataSource.payCountDownSec * 1000" :valueStyle="{fontSize: '14px'}" />
		</a-descriptions-item>
		<a-descriptions-item label="预定方式" :span="3">{{ dataSource.bookType == 2 ? '线上' : '线下' }}</a-descriptions-item>
		<!-- {{ sexList[dataSource.gender] }}/ -->
		<a-descriptions-item label="预定人信息" :span="3">{{ dataSource.name }}/{{ dataSource.phone }}</a-descriptions-item>
		<a-descriptions-item label="证件信息" :span="3">
			{{ CERTIFICATION_TYPE_MAP[dataSource.certificateType] }}
			{{ dataSource.certificateNo ? '/' + dataSource.certificateNo : '' }}
		</a-descriptions-item>
		<a-descriptions-item label="预定金额" :span="3">{{ dataSource.money }}元</a-descriptions-item>
		<a-descriptions-item label="最晚签约日期" :span="3">{{ formatDate(dataSource.signDate) }}</a-descriptions-item>
		<a-descriptions-item label="预计租住年限" :span="3">{{ rentYears[dataSource.contractMonth] || '' }}</a-descriptions-item>
		<a-descriptions-item label="预定房源" :span="3">{{ dataSource.houseAddress }}</a-descriptions-item>
		<a-descriptions-item label="预定备注" :span="3">{{ dataSource.comment }}</a-descriptions-item>
		<a-descriptions-item label="预定凭证" :span="3">
			<file-upload :biz-id="dataSource.id" :biz-type="14" only-show-preview />
		</a-descriptions-item>
	</a-descriptions>
	<a-divider type="horizontal" style="background-color: #f5f5f5" />
	<a-descriptions size="small">
		<template #title>
			<div class="d-module-title">
				<b>申请信息</b>
			</div>
		</template>
		<a-descriptions-item label="申请来源" :span="3">
			{{ dataSource.bookApplyInfo.source }}
		</a-descriptions-item>
		<a-descriptions-item label="申请人" :span="3">
			{{ dataSource.bookApplyInfo.applyName }}
		</a-descriptions-item>
		<a-descriptions-item label="申请时间" :span="3">
			{{ dataSource.bookApplyInfo.applyTime }}
		</a-descriptions-item>
	</a-descriptions>
	<template v-if="dataSource.bookStatus === 7 && dataSource.bookRejectInfo">
		<a-divider type="horizontal" style="background-color: #f5f5f5" />
		<a-descriptions size="small">
			<template #title>
				<div class="d-module-title">
					<b>拒绝信息</b>
				</div>
			</template>
			<a-descriptions-item label="拒绝人" :span="3">
				{{ dataSource.bookRejectInfo.rejectName }}
			</a-descriptions-item>
			<a-descriptions-item label="拒绝时间" :span="3">
				{{ dataSource.bookRejectInfo.rejectDate }}
			</a-descriptions-item>
			<a-descriptions-item label="拒绝原因" :span="3">
				{{ dataSource.bookRejectInfo.rejectReason }}
			</a-descriptions-item>
		</a-descriptions>
	</template>
	<template v-if="dataSource.bookStatus === 3 && dataSource.bookSignInfo">
		<a-divider type="horizontal" style="background-color: #f5f5f5" />
		<a-descriptions size="small">
			<template #title>
				<div class="d-module-title">
					<b>签约信息</b>
				</div>
			</template>
			<a-descriptions-item label="签约人" :span="3">
				{{ dataSource.bookSignInfo.signName }}
			</a-descriptions-item>
			<a-descriptions-item label="签约时间" :span="3">
				{{ dataSource.bookSignInfo.signTime }}
			</a-descriptions-item>
		</a-descriptions>
	</template>
	<template v-if="dataSource.bookStatus === 4 && dataSource.bookBackInfo">
		<a-divider type="horizontal" style="background-color: #f5f5f5" />
		<a-descriptions size="small">
			<template #title>
				<div class="d-module-title">
					<b>退定信息</b>
				</div>
			</template>
			<a-descriptions-item label="退定金额" :span="3">{{ dataSource.bookBackInfo.backMoney }}元</a-descriptions-item>
			<a-descriptions-item label="处理人" :span="3">
				{{ dataSource.bookBackInfo.backName }}
			</a-descriptions-item>
			<a-descriptions-item label="退定时间" :span="3">
				{{ dataSource.bookBackInfo.backTime }}
			</a-descriptions-item>
			<a-descriptions-item label="退定备注" :span="3">
				{{ dataSource.bookBackInfo.backRemark }}
			</a-descriptions-item>
			<a-descriptions-item label="退款途径" :span="3">
				{{ dataSource.bookBackInfo.backMoneyTypeVal }}
			</a-descriptions-item>
			<a-descriptions-item label="退款账号" :span="3">
				{{ dataSource.bookBackInfo.backPayAccount }}
			</a-descriptions-item>
			<a-descriptions-item label="退定凭证" :span="3">
				<file-upload :biz-id="dataSource.id" :biz-type="12" only-show-preview />
			</a-descriptions-item>
		</a-descriptions>
	</template>
	<template v-if="dataSource.bookStatus === 5 && dataSource.bookObsoleteInfo">
		<a-divider type="horizontal" style="background-color: #f5f5f5" />
		<a-descriptions size="small">
			<template #title>
				<div class="d-module-title">
					<b>作废信息</b>
				</div>
			</template>
			<a-descriptions-item label="作废人" :span="3">
				{{ dataSource.bookObsoleteInfo.obsoleteName }}
			</a-descriptions-item>
			<a-descriptions-item label="作废时间" :span="3">
				{{ dataSource.bookObsoleteInfo.obsoleteTime }}
			</a-descriptions-item>
			<a-descriptions-item label="作废原因" :span="3">
				{{ dataSource.bookObsoleteInfo.obsoleteReason }}
			</a-descriptions-item>
		</a-descriptions>
	</template>
	<template v-if="dataSource.bookStatus === 9 && dataSource.confiscateInfo">
		<a-divider type="horizontal" style="background-color: #f5f5f5" />
		<a-descriptions size="small">
			<template #title>
				<div class="d-module-title">
					<b>罚没信息</b>
				</div>
			</template>
			<a-descriptions-item label="操作人" :span="3">
				{{ dataSource.confiscateInfo.confiscateName }}
			</a-descriptions-item>
			<a-descriptions-item label="操作时间" :span="3">
				{{ dataSource.confiscateInfo.confiscateTime }}
			</a-descriptions-item>
			<a-descriptions-item label="罚没原因" :span="3">
				{{ dataSource.confiscateInfo.confiscateReason }}
			</a-descriptions-item>
		</a-descriptions>
	</template>

	<template v-if="dataSource.bookStatus === 8 && dataSource.transferInfo">
		<a-divider type="horizontal" style="background-color: #f5f5f5" />
		<a-descriptions size="small">
			<template #title>
				<div class="d-module-title">
					<b>转移结果</b>
				</div>
			</template>
			<a-descriptions-item label="转移方式" :span="3">
				{{ dataSource.transferInfo.transferType === 1 ? '房间' : '人员' }}
			</a-descriptions-item>
			<a-descriptions-item :label="dataSource.transferInfo.transferType === 1 ? '转移地址' : '转移人信息'" :span="3">
				{{ dataSource.transferInfo.transfer }}
			</a-descriptions-item>
		</a-descriptions>
	</template>
</template>
<script setup lang="ts">
	import {rentYears, sexList} from '@/utils'
	import {CERTIFICATION_TYPE_MAP} from 'yuxin-base/src/constant/index'
	import FileUpload from '@/components/common/file-upload.vue'
	import {formatDate} from 'yuxin-base/src/utils/date'

	const props = defineProps<{
		dataSource: any
	}>()
</script>
